package com.fand.platform.userCenter.validator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

import com.fand.platform.userCenter.service.UserCenterService;

import com.fand.platform.userCenter.dto.UserReDto;

/**
 * 用户关系
 *
 * @author yaoHT
 * 
 */
@Component(UserReValidator.BEAN_ID)
public class UserReValidator implements Validator {
	public static final String BEAN_ID = "com.fand.platform.userCenter.validator.UserReValidator";
	
	@Qualifier(UserCenterService.BEAN_ID)
	@Autowired(required = false)
	private UserCenterService userCenterService;
	
	@Override
	public boolean supports(Class<?> clazz) {
		return UserReDto.class.equals(clazz);
	}
	
	@Override
	public void validate(Object target, Errors errors) {
		UserReDto userRe = (UserReDto) target;
		
		//if (StringUtils.isBlank(userRe.getCode())) {
		//	errors.reject("userRe.code.required", "编号不能为空");
		//}
	}
}
